﻿Imports IControl.IControls
Imports DevExpress.LookAndFeel
Imports DevExpress.XtraEditors
Imports DevExpress.XtraLayout
Imports DevExpress.XtraGrid.Views.Grid
Imports System.Drawing

Public Class IFormDonRong
    Dim bd As BindingSource
    Dim header As String = ""
    Dim address As String = ""
    Private WithEvents view As DevExpress.XtraGrid.Views.Grid.GridView
    Private Sub view_CustomDrawRowIndicator(sender As Object, e As DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs) Handles view.CustomDrawRowIndicator
        Dim view As GridView = DirectCast(sender, GridView)
        Dim indicatorIcon As Boolean = False
        If e.RowHandle >= 0 Then 'trừ trường hợp -1
            'Check whether the indicator cell belongs to a data row
            If e.Info.IsRowIndicator Then
                e.Info.DisplayText = (e.RowHandle + 1).ToString()
                If Not indicatorIcon Then
                    e.Info.ImageIndex = -1
                End If
            End If
        End If
    End Sub
    ''' <summary>
    ''' Set thông tin của doanh nghiệp 
    ''' </summary>
    ''' <param name="company">Tên công ty</param>
    ''' <param name="address">Địa chỉ</param>
    ''' <remarks></remarks>
    Public Sub setHeaderFooter(ByVal company As String, ByVal address As String)
        Me.IGridView1.setHeaderFooter(company, address, Me.printingSystem1, Me.PrintableComponentLink1)
    End Sub
    Public Sub setObj(ByVal bd As BindingSource)
        Me.bd = bd
    End Sub

    Protected Overridable Sub BarButtonItemThoat_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemThoat.ItemClick, BarStaticItemThoat.ItemClick
        Me.Close()
    End Sub

    Protected Overridable Sub BarButtonItemFirst_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemFirst.ItemClick
        Me.bd.MoveFirst()
    End Sub

    Protected Overridable Sub BarButtonItemPrevious_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemPrevious.ItemClick
        Me.bd.MovePrevious()
    End Sub

    Protected Overridable Sub BarButtonItemNext_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemNext.ItemClick
        Me.bd.MoveNext()
    End Sub

    Protected Overridable Sub BarButtonItemLast_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLast.ItemClick
        Me.bd.MoveLast()
    End Sub

    Protected Overridable Sub IFormDonRong_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        setAppearanceSearchLookupEdit(Me.LayoutControl1)
    End Sub
    Public Sub setAppearanceSearchLookupEdit(ByVal lc As LayoutControl)
        For Each item In lc.Items
            If TypeOf item Is LayoutControlItem Then
                Dim ct As Control = DirectCast(item, LayoutControlItem).Control
                If TypeOf ct Is BaseEdit Then
                    If TypeOf ct Is ISearchLookupEdit Then
                        DirectCast(ct, ISearchLookupEdit).Properties.View.IndicatorWidth = 55
                        DirectCast(ct, ISearchLookupEdit).Properties.View.OptionsView.EnableAppearanceEvenRow = True
                        DirectCast(ct, ISearchLookupEdit).Properties.View.Appearance.EvenRow.BackColor = Color.LightCyan
                        DirectCast(ct, ISearchLookupEdit).Properties.NullText = "[Chọn]"
                        Me.view = CType(ct, SearchLookUpEdit).Properties.View
                        AddHandler view.CustomDrawRowIndicator, AddressOf view_CustomDrawRowIndicator
                    End If
                End If
            End If
        Next
    End Sub
    Protected Overridable Sub BarButtonItemLamTuoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLamTuoi.ItemClick, BarStaticItemLamTuoi.ItemClick

    End Sub

    Protected Overridable Sub BarButtonItemTaoMoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemTaoMoi.ItemClick

    End Sub

    Protected Overridable Sub BarButtonItemLuu_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLuu.ItemClick

    End Sub

    Protected Overridable Sub BarButtonItemSua_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemSua.ItemClick

    End Sub

    Protected Overridable Sub BarButtonItemXoa_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemXoa.ItemClick

    End Sub


    Protected Overridable Sub BarButtonItemHuyThayDoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemHuyThayDoi.ItemClick

    End Sub

    Private Sub BarButtonGroupBaoCao_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonGroupBaoCao.ItemClick
        Me.BarButtonItemBaoCao.PerformClick()
    End Sub

    Private Sub BarStaticItemBaoCao_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarStaticItemBaoCao.ItemClick
        Me.BarButtonItemBaoCao.PerformClick()
    End Sub
End Class
